﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Domep.Server.BusinessObjects;

namespace Domep.Server.Contracts
{
    //coucouFromSimon
    [DataContract]
    public class AppliancePresentation
    {
        [DataMember]
        private string name;
        [DataMember]
        private string reference;
        [DataMember]
        private string serialNumber;
        [DataMember]
        private string brand;
        [DataMember]
        private ApplianceType type;
        [DataMember]
        private int firmwareNumber;
        [DataMember]
        private int protocolId;
        [DataMember]
        private List<string> functionalities;


        public string Name { get { return name; } }
        public string Reference { get { return reference; } }
        public string SerialNumber { get { return serialNumber; } }
        public string Brand { get { return brand; } }
        public ApplianceType Type { get { return type; } }
        public int FirmwareNumber { get { return firmwareNumber; } }
        public int ProtocolId { get { return protocolId; } }
        public List<String> Functionalities { get { return functionalities; } }

        public AppliancePresentation(Appliance appliance)
        {
            this.name = appliance.Model.Name;
            this.reference = appliance.Reference;
            this.serialNumber = appliance.SerialNumber;
            this.brand = appliance.Model.Brand;
            this.type = appliance.Model.Type;
            this.firmwareNumber = appliance.FirmwareNumber;
            this.protocolId = appliance.ProtocolId;
            this.functionalities = new List<string>();
            foreach (Functionality f in appliance.Model.Functionalities)
                functionalities.Add(f.Name);
        }
    }
}